﻿namespace Dcms.BLL
{
    using Dcms.IDAL;
    using Dcms.Model;
    using System;
    using System.Collections.Generic;

    public class Dcms_PerRoleBLL
    {
        private IDcms_PerRoleDAL prOp = Dcms.DALFactory.DALFactory.CreateDcms_PerRole();

        public Dcms_PerRoleModel AddModel(Dcms_PerRoleModel model)
        {
            return this.prOp.AddModel(model);
        }

        public void DeleteModelByID(int ID)
        {
            this.prOp.DeleteModelByID(ID);
        }

        public Dcms_PerRoleModel GetModelByID(int ID)
        {
            return this.prOp.GetModelByID(ID);
        }

        public Dcms_PerRoleModel GetModelByPIdAndRId(int CateID, int RoleId)
        {
            return this.prOp.GetModelByPIdAndRId(CateID, RoleId);
        }

        public string GetPIdByRId(int RId, string Flag)
        {
            string str = "0";
            IList<Dcms_PerRoleModel> pIdByRId = this.prOp.GetPIdByRId(RId, Flag);
            for (int i = 0; i < pIdByRId.Count; i++)
            {
                Dcms_PerRoleModel model = pIdByRId[i];
                str = str + "," + model.PerRole_CId;
            }
            return str;
        }

        public Dcms_PerRoleModel Update(Dcms_PerRoleModel model)
        {
            return this.prOp.Update(model);
        }
    }
}

